package com.gs.cd.model.resource;

import com.baomidou.mybatisplus.annotation.IdType;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.util.List;

import com.diboot.core.binding.annotation.BindEntityList;
import com.gs.cd.eum.CategoryEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 *
 * </p>
 *
 * @author seven
 * @since 2020-12-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class SysResourceGroup implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    private String parentId;

    private String name;

    private String description;

    private Integer sort;

    private String saleCode;

    private String creator;

    private Date createTime;

    private String updator;

    private Date updateTime;

    /**
     * 唯一性字段，和id等同
     */
    private String code;

    /**
     * 所属层级
     */
    private CategoryEnum category;


    @TableField(exist = false)
    @BindEntityList(entity = SysResourceGroup.class, condition = "this.id=parentId", deepBind = true, orderBy = "sort")
    private List<SysResourceGroup> childResourceGroup;

    @TableField(exist = false)
    private List<SysResource> sysResourceList;
}
